/*
 * POJO used for transfering all the objects related to the Query
 after the parsing of the SQL query is complete
 */
package com.querie.parser;

import java.util.List;

import com.querie.pojo.*;

/**
 *
 * @author a-skoshy
 */
public class Query {

    private String query;
    private String queryID;
    private boolean isSimple = true;
    private FragmentParams fragments;
    private List<Table> tables;
    private List<Column> columns;
    private List<WCondition> conditions;

    public Query(String query) {
        this.query = query;
    }

    public String getQueryID() {
        return queryID;
    }

    public void setQueryID(String queryID) {
        this.queryID = queryID;
    }

    public void setIsSimple(boolean b) {
        this.isSimple = b;
    }

    public void setFragments(FragmentParams frag) {
        this.fragments = frag;
    }

    public String toString() {
        String message = "Original query:" + query + "\n" + "Fragment:" + fragments + "\n";
        for (Table t : tables) {
            message = message + t;
        }
        for (Column c : columns) {
            message = message + c;
        }
        if(conditions != null){
            for(WCondition w: conditions){
                message = message + w;
            }
        }
        return message;
    }

    public String getQuery() {
        return query;
    }

    public void setQuery(String query) {
        this.query = query;
    }

    public FragmentParams getFragments() {
        return fragments;
    }

    public boolean isIsSimple() {
        return isSimple;
    }

    public List<Table> getTables() {
        return tables;
    }

    public void setTables(List<Table> tables) {
        this.tables = tables;
    }

    public List<Column> getColumns() {
        return columns;
    }

    public void setColumns(List<Column> columns) {
        this.columns = columns;
    }

    public List<WCondition> getConditions() {
        return conditions;
    }

    public void setConditions(List<WCondition> conditions) {
        this.conditions = conditions;
    }

}
